package hcn.protocol.brandnew.zhenliao.jianyan;

import lombok.Data;
import javax.xml.bind.annotation.*;
import java.util.List;
import hcn.protocol.brandnew.BaseRequest;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import ctd.util.xml.jaxb.DateTimeAdapter;
import org.atag.sysrouter.annotation.DictionaryMapping;

import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;


/**
 * 检验危急值查询-请求消息 - ODS_03050301
 *
 * @author enjoyLife
 */
@Data
@XmlRootElement(name = "MsgBody")
@XmlAccessorType(XmlAccessType.FIELD)
public class LabWarnResultQueryRequest extends BaseRequest {

    /**
     * 就诊摘要
     */
    @XmlElement(name = "Visit")
    private Visit visit;
    /**
     * 危急值信息
     */
    @XmlElement(name = "LabWarnRecord")
    private LabWarnRecord labWarnRecord;
    /**
     * 闭环信息
     */
    @XmlElement(name = "ClpInfo")
    private ClpInfo clpInfo;

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Visit {

        /**
         * 就诊流水号
         */
        @XmlElement(name = "VisitId")
        private String visitId;
        /**
         * 就诊机构代码
         */
        @XmlElement(name = "VisitOrganization")
        private String visitOrganization;
        /**
         * 患者类型代码
         */
        @XmlElement(name = "PatientType")
        @DictionaryMapping("CV09_00_404")
        private String patientType;
        /**
         * 患者类型名称
         */
        @XmlElement(name = "PatientTypeName")
        private String patientTypeName;
        /**
         * 门（急）诊号
         */
        @XmlElement(name = "ClinicId")
        private String clinicId;
        /**
         * 住院号
         */
        @XmlElement(name = "HospizationId")
        private String hospizationId;
        /**
         * 科室代码
         */
        @XmlElement(name = "DeptCode")
        private String deptCode;

        @XmlElement(name = "MedicalCardId")
        private String medicalCardId;

        @XmlElement(name = "SickbedId")
        private String sickbedId;
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class LabWarnRecord {

        /**
         * 危急值发布机构代码
         */
        @XmlElement(name = "ReportOrganization")
        private String reportOrganization;
        /**
         * 危急值需通知医师代码
         */
        @XmlElement(name = "NoticeDoctor")
        private String noticeDoctor;
        /**
         * 医师处理标志
         */
        @XmlElement(name = "DoctorTreatSign")
        private String doctorTreatSign;
        /**
         * 护士处理标志
         */
        @XmlElement(name = "NurseTreatSign")
        private String nurseTreatSign;
        /**
         * 发布日期时间（起始）
         */
        @XmlElement(name = "ReportTime_B")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date reportTimeB;
        /**
         * 发布日期时间（截止）
         */
        @XmlElement(name = "ReportTime_E")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date reportTimeE;

        //以下字段医共体模型未维护
        @XmlElement(name = "WarnId")
        private String warnId;
        @XmlElement(name = "TreatorType")
        private String treatorType;
        @XmlElement(name = "TreatDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private String treatDateTime;
        @XmlElement(name = "Treator")
        private String treator;
        @XmlElement(name = "TreatResult")
        private String treatResult;
        @XmlElement(name = "TreatDoctor")
        private String treatDoctor;//处理医生
    }

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class ClpInfo {

        /**
         * 业务ID
         */
        @XmlElement(name = "BusinessID")
        private String businessID;
        /**
         * 业务循环节点ID
         */
        @XmlElement(name = "BusinessCircleID")
        private String businessCircleID;
        /**
         * 多主键业务ID
         */
        @XmlElement(name = "BusinessCompsiteID")
        private String businessCompsiteID;
        /**
         * 流程编码
         */
        @XmlElement(name = "FlowCode")
        private String flowCode;
        /**
         * 流程名称
         */
        @XmlElement(name = "FlowName")
        private String flowName;
        /**
         * 操作类型编码
         */
        @XmlElement(name = "OperateTypeCode")
        private String operateTypeCode;
        /**
         * 操作类型名称
         */
        @XmlElement(name = "OperateTypeName")
        private String operateTypeName;
        /**
         * 操作员工号
         */
        @XmlElement(name = "OperatorCode")
        private String operatorCode;
        /**
         * 操作员姓名
         */
        @XmlElement(name = "OperatorName")
        private String operatorName;
        /**
         * 操作科室代码
         */
        @XmlElement(name = "OperateDeptCode")
        private String operateDeptCode;
        /**
         * 操作科室姓名
         */
        @XmlElement(name = "OperateDeptName")
        private String operateDeptName;
        /**
         * 操作日期时间
         */
        @XmlElement(name = "OperateDateTime")
        @XmlJavaTypeAdapter(DateTimeAdapter.class)
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date operateDateTime;
        /**
         * 分组id
         */
        @XmlElement(name = "GroupId")
        private String groupId;
        /**
         * 分组名称
         */
        @XmlElement(name = "GroupName")
        private String groupName;
        /**
         * 备注信息
         */
        @XmlElement(name = "OperateComments")
        private String operateComments;
    }

}
